#ifndef _OTConstants_h_
#define _OTConstants_h_

#ifdef __cplusplus
extern "C"
{
#endif

    /** @defgroup constants OTFeed API Constants
     *  Constants that were used in API.
     *  @{
     */

    /** API states */

    /** API state: the client is inactive */
    const unsigned int OT_STATUS_INACTIVE = 1 ;

    /** API state: the client is trying to connect */
    const unsigned int OT_STATUS_CONNECTING = 2 ;

    /** API state: the client is connected, but still not logged in */
    const unsigned int OT_STATUS_CONNECTED = 3 ;

    /** API state: the client is logged in */
    const unsigned int OT_STATUS_LOGGED_IN = 4 ;



    /** Message codes */

    /** End of data */
    const unsigned int OT_MSG_END_OF_DATA = 10 ;

    /** Confirmation of the cancel command */
    const unsigned int OT_MSG_END_OF_REQUEST = 20 ;

    /** End of snapshot data */
    const unsigned int OT_MSG_END_OF_SNAPSHOT = 30 ;



    /** Instrument types */

    /** Stock */
    const unsigned int OT_INSTRUMENT_STOCK = 1 ;

    /** Index */
    const unsigned int OT_INSTRUMENT_INDEX = 2 ;

    /** Option */
    const unsigned int OT_INSTRUMENT_OPTION = 3 ;

    /** Future */
    const unsigned int OT_INSTRUMENT_FUTURE = 4 ;


    /** Historical data types */

    /** Raw ticks */
    const unsigned int OT_HIST_RAW_TICKS = 1 ;

    /** Tick-based OHLC values */
    const unsigned int OT_HIST_OHLC_TICK_BASED = 2 ;

    /** Minutely OHLC values */
    const unsigned int OT_HIST_OHLC_MINUTELY = 3 ;

    /** Hourly OHLC values */
    const unsigned int OT_HIST_OHLC_HOURLY = 4 ;

    /** Daily OHLC values */
    const unsigned int OT_HIST_OHLC_DAILY = 5 ;

    /** Weekly OHLC values */
    const unsigned int OT_HIST_OHLC_WEEKLY = 6 ;

    /** Monthly OHLC values */
    const unsigned int OT_HIST_OHLC_MONTHLY = 7 ;

    /** Yearly OHLC values */
    const unsigned int OT_HIST_OHLC_YEARLY = 8 ;

    /** Books */
    const unsigned int OT_HIST_BOOKS = 9 ;

    /** List Symbols */
    const unsigned int OT_LIST_SYMBOLS = 10 ;

    /** Error types */

    /** opentick error */
    const unsigned int OT_ERR_OPENTICK = 1000      ;

    /** System error */
    const unsigned int OT_ERR_SYSTEM = 2000 ;

    /** Network error */
    const unsigned int OT_ERR_SOCK = 3000 ;



    /** Error codes */

    /** Incorrect login */
    const unsigned int OT_ERR_INCORRECT_LOGIN = 1001    ;

    /** You are not logged in */
    const unsigned int OT_ERR_NOT_LOGGED_IN = 1002    ;

    /** Requested data does not exist */
    const unsigned int OT_ERR_NO_DATA = 1003    ;

    /** Invalid cancelId */
    const unsigned int OT_ERR_INVALID_CANCEL_ID = 1004    ;

    /** Invalid interval type or value
     *   of the request for historical data
     */
    const unsigned int OT_ERR_INVALID_INTERVAL = 1005    ;

    /** You do not have a license to
     *   request real-time data from the
     *   specified exchange
     */
    const unsigned int OT_ERR_NO_LICENSE = 1006    ;

    /** Your symbol limit is exceeded */
    const unsigned int OT_ERR_LIMIT_EXCEEDED = 1007    ;

    /** You have requested this
     *   tick stream already
     */
    const unsigned int OT_ERR_DUPLICATE_REQUEST = 1008    ;

    /** Your account is inactive */
    const unsigned int OT_ERR_INACTIVE_ACCOUNT = 1009    ;

    /** You are logged in already */
    const unsigned int OT_ERR_LOGGED_IN = 1010 ;

    /** Parameters of the request
     *   are incorrect
     */
    const unsigned int OT_ERR_BAD_REQUEST = 1011 ;

    /** You are not subscribed to
     *   a historical data package
     */
    const unsigned int OT_ERR_NO_HIST_PACKAGE = 1012 ;

    /** You made maximally possible
     *   count of historical requests
     */
    const unsigned int OT_ERR_MAX_HIST_REQUESTS = 1013 ;


    /** Cannot initialize WinSockets library */
    const unsigned int OT_ERR_NO_SOCKETS_DLL = 2001 ;

    /** Server error */
    const unsigned int OT_ERR_SERVER_ERROR = 2002 ;

    /** Cannot connect to the server */
    const unsigned int OT_ERR_CANNOT_CONNECT = 2003 ;

    /** The connection has been broken */
    const unsigned int OT_ERR_BROKEN_CONNECTION = 2004 ;

    /** Cannot create thread */
    const unsigned int OT_ERR_NO_THREAD = 2005 ;
                                 
    /** Cannot initialize socket */
    const unsigned int OT_ERR_NO_SOCKET = 2006 ;

/// /** Receive error */
///const unsigned int OT_ERR_RECEIVE = 2007 ;

    /** Bits of the option chain or option init params mask */

    /** without date and prices */
    const unsigned int OT_OPTION_NONE = 0  ;

    /** with date but without prices */
    const unsigned int OT_OPTION_DATE = 1  ;

    /** with prices but without date */
    const unsigned int OT_OPTION_PRICE = 2  ;

    /** with date and prices */
    const unsigned int OT_OPTION_FULL = (OT_OPTION_DATE|OT_OPTION_PRICE)  ;

    /** Bits of the tick stream or option chain request mask */

    /** Quote */
    const unsigned int OT_TICK_TYPE_QUOTE = 1 ;

    /** MMQuote */
    const unsigned int OT_TICK_TYPE_MMQUOTE = 2 ;

    /** Trade */
    const unsigned int OT_TICK_TYPE_TRADE = 4 ;

    /** BBO */
    const unsigned int OT_TICK_TYPE_BBO = 8 ;

    /** Level1 data */
    const unsigned int OT_TICK_TYPE_LEVEL1 = (OT_TICK_TYPE_QUOTE|OT_TICK_TYPE_TRADE|OT_TICK_TYPE_BBO) ;

    /** Level2 data */
    const unsigned int OT_TICK_TYPE_LEVEL2 = OT_TICK_TYPE_MMQUOTE ;

    /** Both levels data */
    const unsigned int OT_TICK_TYPE_BOTH = (OT_TICK_TYPE_LEVEL1|OT_TICK_TYPE_LEVEL2) ;

    /** All data */
    const unsigned int OT_TICK_TYPE_ALL = OT_TICK_TYPE_BOTH ;

    /** Bits of the books request mask */

    /** Book Cancel events */
    const unsigned int OT_BOOK_TYPE_CANCEL = 16 ;
    /** Book Change events */
    const unsigned int OT_BOOK_TYPE_CHANGE = 32 ;
    /** Book Delete events */
    const unsigned int OT_BOOK_TYPE_DELETE = 64 ;
    /** Book Execute events */
    const unsigned int OT_BOOK_TYPE_EXECUTE = 128 ;
    /** Book Order events */
    const unsigned int OT_BOOK_TYPE_ORDER = 256 ;
    /** Book Price Level events */
    const unsigned int OT_BOOK_TYPE_PRICE_LEVEL = 512 ;
    /** Book Purge events */
    const unsigned int OT_BOOK_TYPE_PURGE = 1024 ;
    /** Book Replace events */
    const unsigned int OT_BOOK_TYPE_REPLACE = 2048 ;
    /** All book events */
    const unsigned int OT_BOOK_TYPE_ALL = (OT_BOOK_TYPE_CANCEL|OT_BOOK_TYPE_CHANGE|OT_BOOK_TYPE_DELETE|OT_BOOK_TYPE_EXECUTE|OT_BOOK_TYPE_ORDER|OT_BOOK_TYPE_PRICE_LEVEL|OT_BOOK_TYPE_PURGE|OT_BOOK_TYPE_REPLACE)  ;

    /** Volume type mask bit (24th bit: 0 - consolidated; 1 - individual) */
    /** Individual volume*/
    const unsigned int OT_VOLUME_TYPE_INDIVIDUAL = 16777216 ;
    /** Consolidated volume*/
    const unsigned int OT_VOLUME_TYPE_CONSOLIDATED = 0 ;

    /** List symbols request mask.
     *  Types (bits) of equities (you can combine them using "|" operator).
     */

    /** Stock */
    const unsigned int OT_LIST_SYMBOLS_STOCK = 1 ;
    /** Index */
    const unsigned int OT_LIST_SYMBOLS_INDEX = 2 ;
    /** Option */
    const unsigned int OT_LIST_SYMBOLS_OPTION = 4 ;
    /** Future */
    const unsigned int OT_LIST_SYMBOLS_FUTURE = 8 ;
    /** SSFuture */
    const unsigned int OT_LIST_SYMBOLS_SSFUTURE = 16 ;
    /** Top ten*/
    const unsigned int OT_LIST_SYMBOLS_TOP_TEN = 32 ;
    /** All types*/
    const unsigned int OT_LIST_SYMBOLS_ALL_TYPES = (OT_LIST_SYMBOLS_STOCK| OT_LIST_SYMBOLS_INDEX| OT_LIST_SYMBOLS_OPTION| OT_LIST_SYMBOLS_FUTURE| OT_LIST_SYMBOLS_SSFUTURE| OT_LIST_SYMBOLS_TOP_TEN) ;

    /** Kind of name usage
     * (only one could be specified)
     */
    const unsigned int OT_LIST_SYMBOLS_STARTSWITH = 0 ;
    const unsigned int OT_LIST_SYMBOLS_CONTAINS = 0x20000 ;

#ifdef __cplusplus
} 
#endif

#endif // _OTConstants_h_
